package com.ys.peony.app;

import android.app.Application;
import android.content.Context;
import android.graphics.ColorMatrixColorFilter;
import android.os.Build;
import android.os.StrictMode;

import com.tencent.bugly.crashreport.CrashReport;
import com.ys.peony.database.DataBaseUtil;

/**
 * 自定义应用入口
 *
 * @author Hunter
 */
public class BaseApplication extends Application {

    //private final static String BUGLY_APPID = "58d752d115";//测试
    private final static String BUGLY_APPID = "d439c4d922";//正式

    private static BaseApplication mInstance;

    public static Context getInstance() {
        return mInstance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
        //保存错误日志
        /*CrashHandler crashHandler = CrashHandler.getInstance();
        crashHandler.init(this);*/
        CrashReport.initCrashReport(getApplicationContext(), BUGLY_APPID, false);
        //DataBaseUtil.initDataBase();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
            StrictMode.setVmPolicy(builder.build());
            builder.detectFileUriExposure();
        }
    }

}
